# 腾讯云短信应用的 app_id
TENCENT_SMS_APP_ID = 1400938122
# 腾讯云短信应用的 app_key
TENCENT_SMS_APP_KEY = "8e7d2ef98b5630e7d06fdf871d6cb04e"
# 腾讯云短信签名内容
TENCENT_SMS_SIGN = "好家猫公众号"

TENCENT_SMS_TEMPLATE = {
    'register': 2269489,
    'login': 2269488
}
# 发送邮件相关配置
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.qq.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '69838202@qq.com'
EMAIL_HOST_PASSWORD = 'bwyeltpejaxibide'  # 授权码,设置邮箱时产生的授权码
DEFAULT_FROM_EMAIL = '69838202@qq.com'

# redis配置内容:
REDIS_PASSWORD = "iot_user123456IOT_USER"  # 集中管理密码
CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        # "LOCATION": "redis://192.168.2.4:6379",  # 安装redis的主机的 IP 和 端囗 (本地)
        "LOCATION": "redis://139.155.127.236:6379/1",  # 缓存使用DB 1
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
            # "PASSWORD": "foobared",  # redis密码，上线后改为：iot_user123456IOT_USER(本地)
            "PASSWORD": REDIS_PASSWORD,  # redis密码，上线后改为：iot_user123456IOT_USER(上线)
            "CONNECTION_POOL_KWARGS": {
                "max_connections": 1000,
                "encoding": 'utf-8'
            },

        }
    }
}

CHANNEL_LAYERS = {
    "default": {
        "BACKEND": "channels_redis.core.RedisChannelLayer",  # 需pip install channels-redis django-redis
        "CONFIG": {
            # "hosts": [("139.155.127.236", 6379)],  # WebSocket通道使用默认DB 0
            # "password": "iot_user123456IOT_USER",  # 显式指定密码
            "hosts": [f"redis://:{REDIS_PASSWORD}@139.155.127.236:6379/0"],  # WebSocket使用DB 0
            "channel_capacity": {
                "http.request": 200,
                "websocket.send": 50,
            }
        },
    }
}